<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function foo(i){//var
        i = i+30;
        console.log(i);//50
    }

    var i = 20;
    foo(i);
    console.log(i)//20
</script>
</body>
</html>